package com.cskaoyan.market.service;

import com.cskaoyan.market.db.domain.MarketAdmin;
import com.cskaoyan.market.db.domain.MarketAdminExample;
import com.cskaoyan.market.db.mapper.MarketAdminMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Author 鲸落
 * @Date 2024/5/4 9:26
 * @Version 1.0
 */
@Service
public class MarketAdminServiceImpl implements MarketAdminService {
    @Autowired
    MarketAdminMapper marketAdminMapper;
    @Override
    public MarketAdmin login(String username, String password) {
        MarketAdminExample marketAdminExample = new MarketAdminExample();
        //criteria用来构造一系列的where条件
        MarketAdminExample.Criteria criteria = marketAdminExample.createCriteria();
        criteria.andUsernameEqualTo(username);
        criteria.andPasswordEqualTo(password);
        MarketAdmin marketAdmin = marketAdminMapper.selectOneByExample(marketAdminExample);
        //todo 判断是否为null， logService.addLog
        return marketAdmin;
    }
}
